package com.student.cqlg.controller;


import com.student.cqlg.entity.Covid19;
import com.student.cqlg.service.Covid19Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Covid19 Controller
 */
@RestController
@RequestMapping("/api")
public class Covid19Controller {
    @Autowired
    private Covid19Service covid19Service;

    /**
     * 127.0.0.1/api/covid19s ---- get
     */
    @GetMapping(value = "/covid19s")
    public List<Covid19> getCovid19sForProvince() {
        return covid19Service.getCovid19sForProvince();
    }

    /**
     * 127.0.0.1/api/province/covid19s?province=重庆 ---- get
     */
    @GetMapping(value = "/province/covid19s")
    public List<Covid19> getCovid19sByProvince(
            @RequestParam("province") String province) {
        return covid19Service.getCovid19sByProvince(province);
    }

}
